package mq

type MQEngine string

const (
	RabbitMQ MQEngine = "rabbitmq"
	Kafka    MQEngine = "kafka"
	Nats     MQEngine = "nats"
	RocketMQ MQEngine = "rocketmq"
	RedisMQ  MQEngine = "redis"
	Mem      MQEngine = "mem"
	MQTT     MQEngine = "mqtt"
)

func (m MQEngine) Str() string {
	return string(m)
}

type Conn struct {
	Engine   MQEngine `json:"engine"`   // default (mem)
	Address  string   `json:"address"`  // 访问地址 (mem: "" / nil )
	Username string   `json:"username"` // 用户名
	Password string   `json:"password"` // 密码
	Timeout  int      `json:"timeout"`  // 超时时间
}

type Config struct {
	Conn

	Resolves []Conn `json:"resolves"` // 集群解
}
